package com.it.plic;

import java.io.*;
import java.net.Socket;

/**
 * @author げっしょく
 * @date 2021/8/8
 */
public class Demo6 {
    public static void main(String[] args) throws IOException {
        Socket s = new Socket("127.0.0.1", 10000);
        BufferedInputStream bs = new BufferedInputStream(new FileInputStream("D:\\IdeaProjects\\BasicCode\\Info.txt"));
        OutputStream os = s.getOutputStream();
        int a;
        while ((a = bs.read()) != -1) {
            os.write(a);
        }
        s.shutdownOutput();
        BufferedReader bis = new BufferedReader(new InputStreamReader(s.getInputStream()));
        String s1 ;
        while ((s1 = bis.readLine()) != null){
            System.out.println(s1);
        }
        bis.close();
        os.close();
        bs.close();
        s.close();
    }
}
